#This program creates the initial database at runtime
#!/usr/bin/env python
#Arsalan Ahmed
#Robert Hall
#Micheal Longchamps


from __future__ import print_function
import sys
import os
import sqlite3
import string
import random

def create_random_user():
    i = 0
    text = ""
    while(i < 6):
        num = random.randint(1, 26)
        text += string.ascii_lowercase[num - 1]
        i += 1
    return text

def create_random_social():
    i = 0
    text = ""
    while(i <= 10):
        num = random.randint(0, 9)
        
        if(i == 3 or i == 6):
            text += "-"
        else:
            text += string.digits[num]    
        i += 1
    return text
        

def main():
   db = sqlite3.connect("database.sqlite")
   db.execute('''CREATE TABLE IF NOT EXISTS Users(id INTEGER PRIMARY KEY,
name TEXT, password TEXT, email TEXT, social TEXT);''')
   x = 0
   tuple_users1 = (None, "Admin", "12345", "admin@fsu.edu", "123-23-2344")
   db.execute('''INSERT INTO Users VALUES(?,?,?,?,?);''', tuple_users1) 
   db.commit()
   while(x < 100):
       ids = None
       name = create_random_user()   
       password = create_random_user()
       email = create_random_user() + "@fsu.edu"
       social = create_random_social()
       tuple_users = (ids, name, password, email, social)
       db.execute('''INSERT INTO Users VALUES(?,?,?,?,?);''', tuple_users) 
       db.commit()
       x += 1



if __name__ == "__main__":
   main()
